package com.mdb.open.epay.service.epay;


/*
* Copyright (C), 2017-2019 澳发科技(MDB)
* FileName: EpReconCustFileService.java
* Author:   
* Date:     2019-11-29
* History:
* <author>          <time>          <version>          <desc>
*          2019-11-29          V1.00             代码生成器初始生成代码
* -----------------------------------------------------------
* 作者姓名           修改时间           版本号            描述
*/


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mdb.bc.database.mybatisplus.SuperService;
import com.mdb.open.epay.domain.po.epay.EpReconCustFile;
import com.mdb.open.epay.enums.type.ReconTypeEnum;
import com.mdb.open.epay.mapper.epay.EpReconCustFileMapper;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * 类描述：
 *  客户对账文件表 服务类
 *
 * @author 
 * @date 2019-11-29
 */
@Service
public class EpReconCustFileService extends SuperService<EpReconCustFileMapper, EpReconCustFile> {

    /**
     * 獲取全行統一限額配置 默認MOP
     */
    public EpReconCustFile getReconFile(String customerCode, LocalDateTime reconTimeBegin,LocalDateTime reconTimeEnd, ReconTypeEnum reconType) {
        LambdaQueryWrapper<EpReconCustFile> wrapper = new LambdaQueryWrapper<EpReconCustFile>()
                .eq(EpReconCustFile::getType, reconType.getValue())
                .eq(EpReconCustFile::getCustomerCode, customerCode)
                .ge(EpReconCustFile::getReconDate, reconTimeBegin)
                .lt(EpReconCustFile::getReconDate, reconTimeEnd)
                .orderByDesc(EpReconCustFile::getCreateTime);
//        return this.getOne(wrapper);
        return this.getLimitOne(wrapper);

    }


}
